package com.promote.algorithm;

/**
 * @ClassName FindPeakElement
 * Description 寻找峰值 力扣162
 * @Author LiZiHao
 * Date 2023/3/22 16:51
 * @Version 1.0
 **/
public class FindPeakElement {
    public int findPeakElement(int[] nums) {
        int left = 0, right = nums.length - 1;
        while (left < right) {
            int mid = left + (right - left) / 2;
            if (nums[mid] > nums[mid + 1]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return left;
    }
}
